package com.zhuss.controller.food;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.food.food.DetailFoodBo;
import com.zhuss.bean.bo.food.food.ListFoodByCategoryBo;
import com.zhuss.bean.bo.food.food.SearchFoodBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.exception.WpsException;
import com.zhuss.food.food.FoodReadServiceExt;


/**
 * 餐品查询 controller
 * @Author zhushanshuo
   @Date 2020/02/28 16:01
 *
 */
  
 
@RestController
@RequestMapping("/food")
public class FoodReadController extends BaseController {
	
	@Autowired
	@Qualifier("foodReadService")
	private ReadService<Object, Object> foodReadService;
	
	@Autowired
	@Qualifier("foodReadServiceExt")
	private FoodReadServiceExt foodReadServiceExt;
	
	/**
	 * 详情
	 * @param bo
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/detail")
    public Object detail(@RequestBody DetailFoodBo bo) throws WpsException {
		
		Object result = foodReadService.detail(bo);
		return result;
    }
	
	/**
	 * 列表
	 * @param bo
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchFoodBo bo) throws WpsException {
		
		Object result = foodReadService.list(bo);
		return result;
    }
	
	/**
	 * 根据餐品类型查询餐品列表
	 * @param bo
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
    @RequestMapping("/listByCategory")
    public Object listByCategory(@RequestBody ListFoodByCategoryBo bo) throws WpsException {
		
		Object result = foodReadServiceExt.listByCategory(bo);
		return result;
    }
	
}
